<template>
  <div>
    <el-card v-show="show" class="cardTop">
      123
      <!-- <el-button type="primary" style="display:block;margin-left: 0px;" @click="gotoUser">
        <svg-icon icon-class="lock" class="icons" />跳转到用户授权
      </el-button>
      <el-button type="primary" style="display:block;margin-left: 0px;margin-top: 20px;" @click="gotoFirst">
        <svg-icon icon-class="kehu" class="icons" />跳转到客户管理
      </el-button>
      <el-button type="primary" style="display:block;margin-left: 0px;margin-top: 20px;" @click="gotoSecond">
        <svg-icon icon-class="clipboard" class="icons" />跳转到工区管理
      </el-button>
      <el-button type="primary" style="display:block;margin-left: 0px;margin-top: 20px;" @click="gotothird">
        <svg-icon icon-class="tab" class="icons" />跳转到设备管理
      </el-button>
      <el-button type="primary" style="display:block;margin-left: 0px;margin-top: 20px;" @click="gotofourth">
        <svg-icon icon-class="all" class="icons" />跳转到总成管理
      </el-button> -->
    </el-card>
    <router-view />
  </div>
</template>
<script>
export default {
  name: 'Permissions',
  data () {
    return {
      // 储存当前地址
      urlSave: '',
      // 二级按钮的状态伪
      show: false
    }
  },
  mounted () {
    this.getUrl()
  },
  methods: {
    // 判断嵌套路由是否显示
    getUrl () {
      // 截取后七位
      this.urlSave = window.location.href
      // console.log(this.urlSave)
      // 后七位进行判断
      if (this.urlSave.substring(this.urlSave.length - 'permissions'.length) === 'permissions') {
        this.show = true
      } else {
        this.show = false
      }
    },
    // 跳转到客户管理
    gotoFirst () {
      this.$router.push('/nested/menuAll/menu1')
    },
    // 跳转到工区管理
    gotoSecond () {
      this.$router.push('/nested/menuAll/menu2')
    },
    // 跳转到设备管理
    gotothird () {
      this.$router.push('/nested/menuAll/menu3')
    },
    // 跳转到总成管理
    gotofourth () {
      this.$router.push('/nested/menuAll/menu4')
    },
    // 跳转到客户管理
    gotoUser () {
      this.$router.push('/nested/menuAll/menuUser')
    }
  }
}
</script>
